Description:
To improve reliability of your code, always use arrays of zero length instead of null references. This will allow you to get rid of additional checks for null values to avoid null reference exceptions being thrown. RZLA verifies that methods returning array types never return null values.
Incorrect:
type
strArr = array of String;
...
function GetLangList(list:IList):strArr;
begin
if list = nil then
begin
result := nil;
exit;
end;
...
end;
Correct:
function GetLangList(list:IList):strArr;
begin
if list = nil then
begin
SetLength(result, 0);
exit;
end;
...
end;